home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / QuickDraw / Restore Screen Cluts / MenuHandler.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-18  |  4.2 KB  |  110 lines  |  [TEXT/MPS ]

  1. #ifndef __MENUHANDLER__
  2. #define __MENUHANDLER__
  3. /******************************************************************************\
  4. *
  5. * Apple Macintosh Developer Technical Support
  6. *
  7. * Main program file for the ColorReset application
  8. *
  9. * Program: ColorReset
  10. * File:    MenuHandler.h
  11. *
  12. * by:      Forrest Tanaka
  13. *
  14. * Copyright © 1988-1992 Apple Computer, Inc.
  15. * All rights reserved.
  16. *
  17. \******************************************************************************/
  18.  
  19.  
  20. /******************************************************************************\
  21. * Constants
  22. \******************************************************************************/
  23.  
  24. #define mApple 128 /* Menu ID and resource ID of Apple menu */
  25. #define iAbout   1 /* Menu item number of About SevenPaint item */
  26.  
  27. #define mFile 129 /* Menu ID and resource ID of File menu */
  28. #define iOpen   1 /* Menu item number of Open… item */
  29. #define iClose  3 /* Menu item number of Close item */
  30. #define iSaveAs 4 /* Menu item number of Save As… item */
  31. #define iQuit   6 /* Menu item number of Quit item */
  32.  
  33. #define mEdit 130 /* Menu ID and resource ID of Edit menu */
  34. #define iUndo   1 /* Menu item number of Undo item */
  35. #define iCut    3 /* Menu item number of Cut item */
  36. #define iCopy   4 /* Menu item number of Copy item */
  37. #define iPaste  5 /* Menu item number of Paste item */
  38. #define iClear  6 /* Menu item number of Undo item */
  39.  
  40. #define mDisplay     131 /* Menu ID and resource ID of Display menu */
  41. #define iDithering   1   /* Menu item number of Dithering item */
  42. #define iForeground  2   /* Menu item number of Foreground Color… item */
  43. #define iBackgreound 3   /* Menu item number of Background Color… item */
  44.  
  45. #define mLastMenu mDisplay /* Menu ID of the last menu in the menu bar */
  46.  
  47.  
  48. /******************************************************************************\
  49. * StartMenus - Do additional initialization of the menus
  50. *
  51. * This routine is called just after calling the Utilities sample code routine,
  52. * StandardMenuSetup.  This application needs to do just a little bit of
  53. * additional initialization for menus.  See MenuHandler.c for details.
  54. *
  55. * If there isn’t enough memory to load the menus, then memFullErr is returned.
  56. * If desired menu resources couldn’t be found, then resNotFound is returned.  If
  57. * any other error occurs, then dsSysErr is returned.
  58. \******************************************************************************/
  59.  
  60. OSErr StartMenus(void);
  61.  
  62.  
  63. /******************************************************************************\
  64. * DoMenuChoice - Dispatch to the appropriate routine for a menu choice
  65. *
  66. * When it’s determined that a menu item was chosen, this routine is called to
  67. * dispatch to the appropriate routine for the chosen menu item.  The menu item
  68. * and menu number returned by MenuSelect and MenuKey is passed in the menuChoice
  69. * parameter.
  70. \******************************************************************************/
  71.  
  72. void DoMenuChoice(
  73.     long menuChoice);
  74.  
  75.  
  76. /******************************************************************************\
  77. * FixMenus - Fix menus so that proper items are enabled and marked
  78. *
  79. * FixMenus is called to assure that menu items are disable, enabled, marked, and
  80. * unmarked appropriately.  It’s called at the end of every iteration of the main
  81. * event loop.
  82. \******************************************************************************/
  83.  
  84. void FixMenus(void);
  85.  
  86.  
  87. /******************************************************************************\
  88. * DisableAllMenus - Disable all menus except for the Help and Keyboard menus
  89. *
  90. * This routine disables all menus for a modal dialog box.  To restore all the
  91. * menu’s enable states back to the way they were, call RestoreAllMenus.
  92. * FixMenus should not be called between the calls to DisableAllMenus and
  93. * ReenableAllMenus.
  94. \******************************************************************************/
  95.  
  96. void DisableAllMenus(void);
  97.  
  98.  
  99. /******************************************************************************\
  100. * ReenableAllMenus - Reenable menus that were enabled at DisableAllMenus
  101. *
  102. * ReenableAllMenus reenables all menus that were disabled with DisableAllMenus.
  103. * This routine should be called after a modal dialog box goes away.
  104. \******************************************************************************/
  105.  
  106. void ReenableAllMenus(void);
  107.  
  108.  
  109. #endif
  110.